<?php
class Info_draftAction extends IntesysAction {
	function index(){
        //筛选结果并显示
		$this->initView();
        $this->dao=D('Info');
		$this->dao->filter('0',$this->view);
		
       //获取全部部门与职员
       $staff=D('Member')->getallgroupmember();
       $this->assign('memberlist',$staff);
       
       if($_POST['requestType']==10000111){
           die(json_encode(array('draft'=>$list,'statu'=>1)));
       }else{
           $this->display();    
       }
	}
	public function update(){
		if($this->_get('id')){
            $this->dao=$this->dao = D('Info');
            $_POST['id']=$this->_get('id');
            if($_POST['type']=='approval'){
                $_POST['status']=3;    
            }
            if($_POST['type']=='plan'){
                $_POST['starttime']=strtotime($_POST['starttime']);
                $_POST['endtime']=strtotime($_POST['endtime']); 
                $_POST['status']=3;      
            }else{
                unset($_POST['starttime'],$_POST['endtime']);    
            }
            //$_POST['content']=str_replace(array("\r\n","\n","\r"),'<br/>',strip_tags($_POST['content']));
			parent::update();
		}
	}
	public function insert(){
        if(IS_POST){
            $this->dao=$this->dao = D('Info');
            $_POST['site_id'] =__SITEID__;
            $_POST['type']=0;
            $_POST['datetime']=time();
            $_POST['member_id']=session(C('USER_AUTH_KEY'));
            //$_POST['content']=str_replace(array("\r\n","\n","\r"),'<br/>',strip_tags($_POST['content']));
            parent::insert();
        }
	}
	public function delete(){
        $this->dao=$this->dao = D('Info');
		if($this->_get('id')){
			parent::delete();
		}
	}
}

